<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.4.4.min.js"></script>
    <title>index</title>
</head>
<body>
<h2>Hello World!</h2>
<a href="${pageContext.request.contextPath}/user2.jsp">不含BindResult的校验user2.jsp</a><br><br>
<a href="${pageContext.request.contextPath}/person.jsp">person.jsp</a><br><br>
<a href="${pageContext.request.contextPath}/order.jsp">order.jsp</a><br><br>
<a href="${pageContext.request.contextPath}/student.jsp">student.jsp</a><br><br>
<a href="${pageContext.request.contextPath}/responseEntityDownloadFile.jsp">responseEntityDownloadFile.jsp</a><br><br>
<a href="${pageContext.request.contextPath}/exception.do?i=20">SimpleMappingExceptionResolver</a><br><br>
<a href="${pageContext.request.contextPath}/testResponseStatusExceptionResolver.do?i=10">测试ResponseStatusExceptionResolver</a><br><br>
<a href="javaScript:void(0)" onclick="testResponseBodyAdvice()">统一封装结果ResponseBodyAdvice</a><br><br>


</body>
<script type="text/javascript">
    function testResponseBodyAdvice() {
        var url = "${pageContext.request.contextPath}/testResponseBodyAdvice.do?i=0";
        $.post(url, function (data) {
            if(200 === data.code){
                alert(JSON.stringify(data))
            }else{
                alert(data.msg)
            }
        },"json");
        //或者
        $.ajax({
            type:"post",
            url:url,
            success:function(data){
                if(200 === data.code){
                    alert(JSON.stringify(data))
                }else{
                    alert(data.msg)
                }
            },
            dataType:"json"
        })
    }
</script>
</html>
